package cxf.spring.demo.service;

import cxf.spring.demo.domain.message.Message;
import cxf.spring.demo.domain.message.MessagesList;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 * Message operations service
 *
 * User: Vlad Vinichenko (akerigan@gmail.com)
 * Date: 06.03.2009
 * Time: 20:23:00
 */
@WebService(name = "message")
public interface MessageService {

    /**
     * Receive id's of new messages
     *
     * @param login User login
     * @return List of messages id's
     * @throws Exception
     */
    @WebMethod(operationName = "getnew")
    public MessagesList getNewMessages(
            @WebParam(name = "login") String login
    ) throws Exception;

    /**
     * Get message by id
     *
     * @param login User login
     * @param messageId Message id
     * @return message
     * @throws Exception
     */
    @WebMethod(operationName = "get")
    public Message getMessage(
            @WebParam(name = "login") String login,
            @WebParam(name = "id") int messageId
    ) throws Exception;

    /**
     * Send new message
     *
     * @param login User login
     * @param message New message
     * @throws Exception
     */
    @WebMethod(operationName = "send")
    public void sendMessage(
            @WebParam(name = "login") String login,
            @WebParam(name = "message") Message message
    ) throws Exception;

    /**
     * Mark messages as read
     *
     * @param login User login
     * @param messagesList List of messages id's
     * @throws Exception
     */
    @WebMethod(operationName = "delete")
    public void delete(
            @WebParam(name = "login") String login,
            @WebParam(name = "messages") MessagesList messagesList
    ) throws Exception;

}
